<script setup>
import { reactive, ref } from "vue";
import { useCounterStore } from "@/stores/counter";
import { storeToRefs } from "pinia";

const store = useCounterStore();
const { lineColor, cropExpandSize, lineWidth, lineStyle, checkList } =
  storeToRefs(store);

const options = [
  {
    value: "#ff0000",
    label: "红色",
  },
  {
    value: "blue",
    label: "蓝色",
  },
  {
    value: "#FFF",
    label: "白色",
  },
  {
    value: "#20200",
    label: "黑色",
  },
];
const emit = defineEmits(["change"]);
</script>

<template>
  <div class="box">
    <el-form
      :label-position="right"
      label-width="80px"
      class="demo-form-inline"
    >
      <el-form-item label="外扩大小:">
        <el-slider v-model="cropExpandSize" />
      </el-form-item>
      <el-form-item label="边框大小:">
        <el-slider v-model="lineWidth" />
      </el-form-item>
      <el-form-item label="边界">
        <el-radio-group v-model="lineStyle">
          <el-radio value="dashed" size="large">虚线</el-radio>
          <el-radio value="solid" size="large">实线</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="边界">
        <el-select
          v-model="lineColor"
          placeholder="Select"
          style="width: 240px"
        >
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="筛选">
        <div class="flex-wrap">
          <el-checkbox-group v-model="checkList" @change="emit('change')">
            <el-checkbox label="框" size="mini" value="rect" />
            <el-checkbox label="线" size="mini" value="line" />
            <el-checkbox label="点" size="mini" value="point" />
            <el-checkbox label="多边形" size="mini" value="polygon" />
            <el-checkbox
              label="框内点"
              size="mini"
              value="rect_line_combination"
            />
          </el-checkbox-group>
        </div>
      </el-form-item>
    </el-form>
  </div>
</template>

<style scoped lang="scss">
.box {
  width: 100%;
  background-color: #181818;
  padding: 10px;
  box-sizing: border-box;
}
</style>
